home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 23 / AMIGAplus Sonderheft 23 (2000)(Falke)(DE)[!].iso / Updates / HD-Installer / -WHDLoad- / WHDLoad_dev / Src / sources / blitfix_dn_58a6.s next >
Text File  |  1999-11-08  |  2KB  |  87 lines

  1. ;*---------------------------------------------------------------------------
  2. ;  :Program.    blitfix_dn_58a6.s
  3. ;  :Contents.    routine to fix program that does not correctly wait for
  4. ;        blitter finish
  5. ;        the instruction which writes the "bltsize" register will be
  6. ;        patched with a routine which will wait for blitter finish
  7. ;        after writing "bltsize"
  8. ;  :Version.    $Id: blitfix_dn_58a6.s 1.1 1998/06/14 20:54:50 jah Exp $
  9. ;  :History.    30.08.97 extracted from Turrican slave
  10. ;  :Requires.    -
  11. ;  :Copyright.    Public Domain
  12. ;  :Language.    68000 Assembler
  13. ;  :Translator.    Barfly V1.131
  14. ;  :To Do.
  15. ;---------------------------------------------------------------------------*
  16. ;
  17. ; this will patch the following instructions:
  18. ;        move.w    d0,($58,a6)
  19. ;        move.w    d1,($58,a6)
  20. ;        move.w    d2,($58,a6)
  21. ;        move.w    d3,($58,a6)
  22. ;        move.w    d4,($58,a6)
  23. ;        move.w    d5,($58,a6)
  24. ;        move.w    d6,($58,a6)
  25. ;        move.w    d7,($58,a6)
  26. ;
  27. ; IN:    A0 = APTR start of memory to patch
  28. ;    A1 = APTR end of memory to patch
  29. ;    A2 = APTR space for patch routine MUST be < $8000 !!!
  30. ; OUT:    D0-D1/A0-A1 destroyed
  31.  
  32. _blitfix_dn_58a6
  33.         movem.l    a2-a4,-(a7)
  34.  
  35.         move.l    a2,d1            ;D1 = jmp table
  36.  
  37.         lea    (.wait_d0),a3
  38.         lea    (.wait_end),a4
  39. .cpy        move.w    (a3)+,(a2)+
  40.         cmp.l    a3,a4
  41.         bne    .cpy
  42.     IFD PATCHCOUNT
  43.         clr.l    (a2)+
  44.         clr.l    (a2)
  45.     ENDC
  46.  
  47. .loop        move.w    (a0)+,d0
  48.         and.w    #$fff8,d0
  49.         cmp.w    #$3d40,d0        ;move.w dx,($58,a6)
  50.         bne    .next
  51.         cmp.w    #$0058,(a0)
  52.         bne    .next
  53.         move.w    -(a0),d0        ;old opcode
  54.         move.w    #$4eb8,(a0)+        ;JSR $XXXX.w
  55.         move.w    d1,(a0)
  56.         and.w    #7,d0            ;register number
  57.     IFD PATCHCOUNT
  58.         addq.b    #1,(-4,a2,d0)
  59.     ENDC
  60.         mulu    #6,d0
  61.         add.w    d0,(a0)+        ;jmp address
  62. .next        cmp.l    a0,a1
  63.         bhs    .loop
  64.  
  65.         movem.l    (a7)+,a2-a4
  66.         rts
  67.  
  68. .wait_d0    move.w    d0,($58,a6)
  69.         bra.b    .wait
  70. .wait_d1    move.w    d1,($58,a6)
  71.         bra.b    .wait
  72. .wait_d2    move.w    d2,($58,a6)
  73.         bra.b    .wait
  74. .wait_d3    move.w    d3,($58,a6)
  75.         bra.b    .wait
  76. .wait_d4    move.w    d4,($58,a6)
  77.         bra.b    .wait
  78. .wait_d5    move.w    d5,($58,a6)
  79.         bra.b    .wait
  80. .wait_d6    move.w    d6,($58,a6)
  81.         bra.b    .wait
  82. .wait_d7    move.w    d7,($58,a6)
  83. .wait        BLITWAIT a6
  84.         rts
  85. .wait_end
  86.  
  87.